import { createSlice } from '@reduxjs/toolkit'

interface AlertState {
  alerts: any[]
  rules: any[]
  loading: boolean
  error: string | null
}

const initialState: AlertState = {
  alerts: [],
  rules: [],
  loading: false,
  error: null,
}

const alertSlice = createSlice({
  name: 'alert',
  initialState,
  reducers: {
    setAlerts: (state, action) => {
      state.alerts = action.payload
    },
    setRules: (state, action) => {
      state.rules = action.payload
    },
  },
})

export const { setAlerts, setRules } = alertSlice.actions
export default alertSlice.reducer

